<script type="text/javascript">
    /**
     * 淇濆瓨鏂板鐨勬ā鍨嬫暟鎹�
     */
    function saveModel() {
        var id=document.getElementById("id").value;
        url = '';
        if(id==""){
            url = '/save';
        }     else{
            url = ' /update';
        }
        $('#myform').form('submit', {
            url : url,
            onSubmit : function() {
                return $(this).form('validate');
            },
            success : function(data) {
                alert(data);
                parent.location.reload();
            }
        });

    }
</script>
    <body class="easyui-layout">
    <form id="myform" method="post">

    <div style="padding: 10px">
        <input type="hidden"  name="id" id="id"    >

        <table cellpadding="0" cellspacing="0" class="form-table">
		  
		<tr>

            <td style="width: 100px">码表类别:</td>
			<td style="width: 200px"> <input id="type"
				name="type" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[10]'" />
			</td>     
            <td style="width: 100px">码表代码:</td>
			<td style="width: 200px"> <input id="code"
				name="code" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[10]'" />
			</td> 
		</tr>
		    
		<tr>

            <td style="width: 100px">码表名称:</td>
			<td style="width: 200px"> <input id="name"
				name="name" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[127.5]'" />
			</td>     
            <td style="width: 100px">码表描述:</td>
			<td style="width: 200px"> <input id="descinfo"
				name="descinfo" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[512]'" />
			</td> 
		</tr>
		    
		<tr>

            <td style="width: 100px">上级码表:</td>
			<td style="width: 200px"> <input id="pid"
				name="pid" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[10]'" />
			</td>     
            <td style="width: 100px">备注:</td>
			<td style="width: 200px"> <input id="rmk"
				name="rmk" type="text"
				class="easyui-validatebox"
				data-options="validType:'maxLength[100]'" />
			</td> 
		</tr>
		      
	</table>
</div>
    </form>

    <div id="dlg-buttons" style="text-align: center">
        <a href="#" class="easyui-linkbutton"
           data-options="iconCls:'icon-save'" onclick="saveModel()">保存</a> <a
            href="#" class="easyui-linkbutton"
            data-options="iconCls:'icon-cancel'"
            onclick="parent.closeDialog();">取消</a>
    </div>
    </body>
    /**
    * 赋值
    */
    <script>
        document.getElementById("type").value  =  '{m.type}';
        document.getElementById("code").value  =  '{m.code}';
        document.getElementById("name").value  =  '{m.name}';
        document.getElementById("descinfo").value  =  '{m.descinfo}';
        document.getElementById("pid").value  =  '{m.pid}';
        document.getElementById("rmk").value  =  '{m.rmk}';
        document.getElementById("optname").value  =  '{m.optname}';
        document.getElementById("optdate").value  =  '{m.optdate}';
    </script>
